home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / lib / partman / check.d / 05duplicate_labels < prev    next >
Text File  |  2009-10-28  |  979b  |  45 lines

  1. #! /bin/sh
  2.  
  3. . /lib/partman/lib/base.sh
  4.  
  5. for dev in $DEVICES/*; do
  6.     [ -d "$dev" ] || continue
  7.     cd $dev
  8.     partitions=
  9.     open_dialog PARTITIONS
  10.     while { read_line num id size type fs path name; [ "$id" ]; }; do
  11.         [ "$fs" != free ] || continue
  12.         [ -s "$id/label" ] || continue
  13.         partitions="${partitions:+$partitions
  14. }$(cat "$id/label") $path"
  15.     done
  16.     close_dialog
  17.     partitions="$(echo "$partitions" | sort)"
  18.  
  19.     oldlabel=
  20.     oldpath=
  21.     IFS="$NL"
  22.     for partition in $partitions; do
  23.         restore_ifs
  24.         label="${partition% *}"
  25.         path="${partition##* }"
  26.         if [ "$label" = "$oldlabel" ]; then
  27.             db_subst partman-target/same_label PART1 "$(humandev "$oldpath")"
  28.             db_subst partman-target/same_label PART2 "$(humandev "$path")"
  29.             db_subst partman-target/same_label LABEL "$label"
  30.             db_capb align
  31.             db_input critical partman-target/same_label || true
  32.             db_go || true
  33.             db_capb backup align
  34.             exit 1
  35.         else
  36.             oldlabel="$label"
  37.             oldpath="$path"
  38.         fi
  39.         IFS="$NL"
  40.     done
  41.     restore_ifs
  42. done
  43.  
  44. exit 0
  45.